package com.management.department.teacherinfosystem.Repository;

import com.management.department.teacherinfosystem.Entity.ProjectFunding;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
public interface ProjectFundingRepository extends JpaRepository<ProjectFunding, Long> {
    List<ProjectFunding> findByProjectId(Long projectId);
    
    @Modifying
    @Transactional
    @Query("DELETE FROM ProjectFunding pf WHERE pf.projectId = :projectId")
    void deleteByProjectId(@Param("projectId") Long projectId);
}
